package com.cashmama.market.api.infras.enums.user;


import com.cashmama.market.api.infras.utils.StringUtils;

/**
 * @author frank
 * @Description: 还款操作系统枚举
 * @date 下午2:11 2017/9/21
 */
public enum OsTypeEnum {

    ANDRIOD("0", "android"),
    IOS("1", "iphone"),
    WAP("3","h5");

    private String code;
    private String desc;

    OsTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getByDesc(String desc){
        String code = "";
        if(StringUtils.isEmpty(desc)){
            return code;
        }


        for(OsTypeEnum osTypeEnum : OsTypeEnum.values()){
            if(osTypeEnum.getDesc().equals(desc)){
                code = osTypeEnum.getCode();
                return code;
            }
        }

        return code;
    }
}
